package com.matt.service;

import com.dotflat.cc.po.ChildrenImportPO;
import com.dotflat.cc.po.ChildrenPO;
import com.matt.commons.dto.sso.AreaDTO;
import com.matt.commons.dto.sso.StaffDTO;
import com.matt.domain.Children;
import com.matt.domain.ChildrenContractInfoRecord;
import com.matt.domain.mp.ParentUser;
import com.matt.domain.record.CheckRecord;
import com.matt.foundation.DO.ChildrenCheckRecordDO;
import com.matt.foundation.DO.ChildrenListDO;
import com.matt.foundation.DO.ChildrenNurseryListDO;
import com.matt.foundation.DO.ClassListDO;
import com.matt.foundation.query.ChildrenNurseryQuery;
import com.matt.foundation.query.ChildrenQuery;
import com.matt.foundation.vo.*;
import com.matt.foundation.vo.children.BabyNClassInfoVO;
import com.matt.foundation.vo.children.WebChildrenVo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.web.multipart.MultipartFile;

import javax.transaction.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2017/7/13
 * *******************************
 */
public interface ChildrenService {

    Children update(StaffDTO staff, String childrenId, ChildrenPO childrenPO);
    Children addWithRealtion(String ticket, StaffDTO staff, ChildrenPO childrenPO);

    Children addWithRealtion(String ticket, StaffDTO staff, ChildrenPO children,String areaId);

    Children add(Children children, String phone, String name, String company, String relation,String province,String city,String district,String detailedAddress,String education,String position,String email);

    @Transactional
    Children add1(Children children, String phone, String name, String company, String relation, String province, String city, String district, String detailedAddress, String education, String position, String email, Date birthDay);

    Children edit(String areaId, String id, String name, String nickName, String birthday, int gender, String weight, String height, String header, String address, String remar);

    Children active(String clienteleId, String contractBeginDate, String contractEndDate, String productJson);

    Page<Children> findChildrenPage(ChildrenQuery query);

    Page<Children> findTianBoChildrenPage(String areaId, PageRequest pageRequest);

    List<ChildrenListVo> getHasChildrenByArea(String areaId);

    List<ChildrenListVo> getChildrenByArea(String areaId, String name);

    Page<ChildrenNurseryListDO> getNurseryValidChildren(ChildrenNurseryQuery query);

    List<ChildrenListDO> getChildrenNonClassesNurseryValid(String areaId, Integer category);

    Children getByNameAndBirthday(String childrenName, Date birthday, String areaId);

    Children getById(String id);

    List<Children> getByIds(String[] childrenIds, String areaId);
    List<Children> getByIds(List<String> childrenIds, String areaId);

    Children getByCrmClienteleId(String id);

    Children getByIdAndAreaId(String id, String areaId);

    Map childrenDetailById(String id);

    List<AppUserDetailVo> getAppUsersByChildrenId(String id);

    CheckRecord checkIn(StaffDTO staff, String childrenId);


    CheckRecord checkIn(AreaDTO area, StaffDTO staff, Integer checkType, String childrenId, MultipartFile file, String sickName,
                        String specialRecord, String exceptionName, Integer healthyTag,
                        String weight, String height, String header, String remark);


    CheckRecord checkIn(AreaDTO area, StaffDTO staff, Integer checkType, String childrenId, MultipartFile file, String sickName,
                        String specialRecord, String exceptionName, Integer healthyTag,
                        String weight, String height, String header, String remark,Integer dayAmount,Integer isHoliday,String ticket);

    CheckRecord checkOut(String staffId, String childrenId);

    CheckRecord checkOut(StaffDTO staff, AreaDTO area, String childrenId, MultipartFile file);

    CheckRecord cancelCheckInRecord(StaffDTO staff, String childrenId, String date);

    List<ClassesCheckRecordVo> findClassesCheckRecordByAreaId(String areaId);

    List<ClassesCheckRecordVo> findClassesCheckRecordByClassId(String classId);

    List<ClassesCheckRecordVo> findClassesCheckRecordByClassId(String classId,Date date);

    List<ClassesCheckRecordVo> findClassesCheckRecordByClasses(List<ClassListDO> classes);

    List<ClassesCheckRecordVo> findStaffCheckRecord(List<String> staffIds, Date beginDate, Date endDate);

    List<ChildrenCheckRecordDO> findChildCheckRecordByClasses(String classesId);

    List<ClassesChildrenListVo> getChildrenByClasses(String classesId);

    List<ClassesChildrenListVo> findClassHourChildrenByClasses(String classesId);

    Map getChildMediaStatisticsInfo(String childId);

    Children dropOut(StaffDTO staff, String childrenId, String reason,String backMoney);

    Children graduate(StaffDTO staff, String areaId, String childrenId) ;

    List<ChildrenListVo> getEvaluatingCBBindList(String areaId, String name);

    Boolean bindEvaluatingCB(String evaluatingCBRecordId, String childrenId);

    Boolean nurseryTransfer(String classesId, String childrenId, String staffId,String remark,String oldClassesId);

    Boolean overNursery(StaffDTO staff, String childrenId, String remark);

    Boolean overEarly(StaffDTO staff, String childrenId, String remark);

    Boolean changeEarlyCourseCount(StaffDTO staff, String childrenId, Integer courseCount, String remark);

    List<ChildrenListDO> getNurseryChildByAppUser(String userId);

    CheckRecord getLastCheckRecord(String childrenId);

    Page<WebChildrenVo> page(ChildrenQuery query);
    List<WebChildrenVo> nonPage(ChildrenQuery query);

//    Children detailBaseInfo(String ticket, String childrenId);

    AppUserDetailVo updateChildrenLinkMans(String childrenId, ParentUser parentUser);

    AppUserDetailVo addChildrenLinkMans(String childrenId, ParentUser parentUser);

    boolean delChildrenLinkMans(String childrenId,String id);

    List<CheckRecord> getLastCheckRecord(List<String> childrenId);

    String getClassesByChildrenId(String childrenId);


    List<CheckRecord> getTodayCheckRecordByChilrenIds(List<String> childrenIdList);

    List<CheckRecord> getCheckRecordsByChilrenId(String areaId, String childrenId, String date);

    List<ChildrenCheckRecordVo> findCheckRecordByAreaId(String areaId);

    ChildrenMonthCheckRecordVo findByClassesByChildrenIdAndMonth(String childrenId,String month);

    boolean mulitCheckIn(StaffDTO staff, AreaDTO area , String[] childrenIds, Integer checkType);

    boolean mulitCheckOut(StaffDTO staff, AreaDTO area, String[] childrenIds);

    //查询当月生日学生
    List<Children> birthdays(String areaId,String classesId);

    //查询学生指定时间在园状态
    List<Children>  getCheckStatus(String areaId,String checkStatus,String date,String classesId);

//    boolean deleteChildrenForStaff(String childrenId, String staffId);

    List<BabyNClassInfoVO> getChildrenClassInfoForCrm(String areaId, Integer category, String childName, String classId, List<String> crmIds);


    List<BabyNClassInfoVO> getChildrenClassInfoForCrmV2(String areaId,  String childName, String classId, List<String> crmIds);


    List<BabyNClassInfoVO> getChildrenClassInfoForCrm(String areaId,  String childName, String classId);

    Integer clienteleAttendanceCount(String areaId, String clienteleId,String startTime, String endTime);

    Map clienteleCourseTimeCount(String areaId, String clienteleId);

    public List<ChildrenContractInfoRecord> getChildrenContractInfoRecord(StaffDTO staffDTO, String childrenId, Date begin, Integer day, Integer type);

    String importChildrenList(String ticket,StaffDTO staff,List<ChildrenImportPO> list) throws Exception;

    void  mulitCheckInV2(String ticket,AreaDTO area, StaffDTO staff, Integer checkType, String[] childrenIds);

    void updateById(Children byId);

    Children addByLeads(String ticket, StaffDTO staff, ChildrenPO children);

    void renewPush(StaffDTO staff, AreaDTO area, String[] childrenIds);
}
